import Main from '@/views/Main.vue';

// 不作为Main组件的子页面展示的页面单独写，如下
export const loginRouter = {
    path: '/login',
    name: 'login',
    component: resolve => {
        require(['@/views/login.vue'], resolve);
    }
};

export const page404 = {
    path: '*',
    name: 'error-404',
    meta: {
        title: '404-页面不存在'
    },
    errorpage: true,
    component: resolve => {
        require(['@/views/error-page/404.vue'], resolve);
    }
};

export const page403 = {
    path: '/403',
    meta: {
        title: '403-权限不足'
    },
    errorpage: true,
    name: 'error-403',
    component: resolve => {
        require(['@/views/error-page/403.vue'], resolve);
    }
};

export const page500 = {
    path: '/500',
    meta: {
        title: '500-服务端错误'
    },
    errorpage: true,
    name: 'error-500',
    component: resolve => {
        require(['@/views/error-page/500.vue'], resolve);
    }
};

export const preview = {
    path: '/preview',
    name: 'preview',
    component: resolve => {
        require(['@/views/form/article-publish/preview.vue'], resolve);
    }
};

export const locking = {
    path: '/locking',
    name: 'locking',
    component: resolve => {
        require(['@/views/main-components/lockscreen/components/locking-page.vue'], resolve);
    }
};

// 作为Main组件的子页面展示但是不在左侧菜单显示的路由写在otherRouter里
export const otherRouter = {
    path: '/',
    name: 'otherRouter',
    redirect: '/home',
    component: Main,
    children: [{
            path: 'home',
            title: '首页',
            name: 'home_index',
            component: resolve => {
                require(['@/pages/Home/home.vue'], resolve);
            }
        },
        {
            path: '/personal-center',
            title: '个人中心',
            name: 'personal-center',
            component: resolve => {
                require(['@/pages/Personal_Center/personal-center.vue'], resolve);
            }
        },
        {
            title: '直播机构',
            path: 'live-ctrl-organization',
            meta:{
                parentName:'live-ctrl-anchor',
            },
            icon: 'ios-flower',
            name: 'live-ctrl-org',
            component: resolve => {
                require(['@/pages/Live_ORG/live-org.vue'], resolve);
            }
        },
        {
            title: '直播间类型',
            path: 'live-ctrl-room-type',
            meta:{
                parentName:'live-ctrl-program',
            },
            icon: 'ios-flower',
            name: 'live-ctrl-room-type',
            component: resolve => {
                require(['@/pages/Live_RoomType/room-type.vue'], resolve);
            }
        },
        {
            title: '直播间管理',
            path: 'live-ctrl-room',
            meta:{
                parentName:'live-ctrl-program',
            },
            icon: 'film-marker',
            name: 'live-ctrl-room',
            component: resolve => {
                require(['@/pages/Live_Room/live-room.vue'], resolve);
            }
        },
        // {
        //     path: 'ownspace',
        //     title: '个人中心',
        //     name: 'ownspace_index',
        //     component: resolve => {
        //         require(['@/views/own-space/own-space.vue'], resolve);
        //     }
        // },
        // {
        //     path: 'order/:order_id',
        //     title: '订单详情',
        //     name: 'order_info',
        //     component: resolve => {
        //         require(['@/views/advanced-router/component/order-info.vue'], resolve);
        //     }
        // }, // 用于展示动态路由
        // {
        //     path: 'shopping',
        //     title: '购物详情',
        //     name: 'shopping',
        //     component: resolve => {
        //         require(['@/views/advanced-router/component/shopping-info.vue'], resolve);
        //     }
        // }, // 用于展示带参路由
        {
            path: 'message',
            title: '消息中心',
            name: 'message_index',
            component: resolve => {
                require(['@/views/message/message.vue'], resolve);
            }
        }
    ]
};

// 作为Main组件的子页面展示并且在左侧菜单显示的路由写在appRouter里
//如果需要为主菜单项目不展开，则第一个子路由title与父级相同即可(不展开的，有且只有一个自路由)。否则为展开式菜单。(展开的，可以1个子也可以多个，但是第一个子的名字不要与父级相同，否则为不展开)
export const appRouter = [{
        path: '/permissions',
        icon: 'locked',
        name: 'permissions',
        title: '权限管理',
        access: 0,
        component: Main,
        children: [{
            title: '权限管理',
            path: 'index',
            access: 0,
            name: 'permissions-index',
            component: resolve => {
                require(['@/pages/Permissions/permissions.vue'], resolve);
            }
        }]
    }, {
        path: '/crm-ctrl',
        icon: 'person-stalker',
        name: 'crm-ctrl',
        title: 'CRM管理',
        component: Main,
        children: [{
            title: '用户管理',
            path: 'user',
            icon: 'person-stalker',
            name: 'crm-ctrl-user',
            component: resolve => {
                require(['@/pages/CRM_UserCtrl/user-ctrl.vue'], resolve);
            }
        }, {
            title: '意见反馈',
            path: 'feedback',
            icon: 'email-unread',
            name: 'crm-feedback',
            component: resolve => {
                require(['@/pages/CRM_Feedback/feedback.vue'], resolve);
            }
        }]
    }, {
        path: '/music',
        icon: 'music-note',
        name: 'music',
        title: '音乐',
        component: Main,
        children: [{
            title: '音乐管理',
            path: 'index',
            icon: 'headphone',
            name: 'music-index',
            component: resolve => {
                require(['@/pages/Music/music.vue'], resolve);
            }
        }, {
            title: '音乐分类管理',
            path: 'music-type',
            icon: 'network',
            name: 'music-type',
            component: resolve => {
                require(['@/pages/Music_Type_Ctrl/music-type-ctrl.vue'], resolve);
            }
        }, {
            title: '作者管理',
            path: 'author-ctrl',
            icon: 'person-add',
            name: 'author-ctrl-index',
            component: resolve => {
                require(['@/pages/Author_Ctrl/author-ctrl.vue'], resolve);
            }
        }]
    }, {
        path: '/video-ctrl',
        icon: 'social-youtube-outline',
        name: 'video-ctrl',
        title: '视频管理',
        component: Main,
        children: [{
            title: '视频管理',
            path: 'index',
            name: 'video-ctrl-index',
            component: resolve => {
                require(['@/pages/Video_Ctrl/video-ctrl.vue'], resolve);
            }
        }]
    },
    {
        path: '/live-ctrl',
        icon: 'ios-videocam',
        name: 'live-ctrl',
        title: '直播管理',
        component: Main,
        children: [{
                title: '直播礼物',
                path: 'gift',
                icon: 'ios-flower',
                name: 'live-ctrl-gift',
                component: resolve => {
                    require(['@/pages/Live_Gift/live-gift.vue'], resolve);
                }
            },
            {
                title: '节目管理',
                path: 'program',
                icon: 'film-marker',
                name: 'live-ctrl-program',
                component: resolve => {
                    require(['@/pages/Live_Program/live-program.vue'], resolve);
                }
            },

            {
                title: '主播管理',
                path: 'anchor',
                icon: 'person-add',
                name: 'live-ctrl-anchor',
                component: resolve => {
                    require(['@/pages/Live_Anchor/live-anchor.vue'], resolve);
                }
            }
        ]
    },
    {
        path: '/information',
        icon: 'document-text',
        title: '资讯',
        name: 'information',
        component: Main,
        children: [{
            path: 'concert',
            title: '音乐会资讯',
            icon: 'disc',
            name: 'information-concert',
            component: resolve => {
                require(['@/pages/Information_Concert/information-concert.vue'], resolve);
            }
        }, {
            path: 'article',
            title: '文海',
            icon: 'android-document',
            name: 'information-article',
            component: resolve => {
                require(['@/pages/Information_Article/information-article.vue'], resolve);
            }
        }]
    },

    {
        path: '/asking-order',
        icon: 'help',
        title: '提问订单',
        name: 'asking-order',
        component: Main,
        children: [{
            path: 'index',
            title: '提问订单',
            name: 'asking-order-index',
            component: resolve => {
                require(['@/pages/Asking_Order/asking-order.vue'], resolve);
            }
        }]
    },
    {
        path: '/app-ctrl',
        icon: 'ios-gear',
        title: 'APP控制',
        name: 'app-ctrl',
        component: Main,
        children: [{
            path: 'video',
            icon: 'social-youtube',
            title: 'APP首页视频',
            name: 'app-ctrl-video',
            component: resolve => {
                require(['@/pages/App_Video/app-video.vue'], resolve);
            }
        }, {
            path: 'launcher',
            icon: 'ios-photos',
            title: 'APP启动图',
            name: 'app-ctrl-launcher',
            component: resolve => {
                require(['@/pages/App_Launcher/app-launcher.vue'], resolve);
            }
        }, {
            path: 'banner',
            icon: 'images',
            title: 'Banner管理',
            name: 'banner-management-index',
            component: resolve => {
                require(['@/pages/App_Banner/app-banner.vue'], resolve);
            }
        }, {
            path: 'version',
            icon: 'android-phone-portrait',
            title: 'APP版本管理',
            name: 'app-ctrl-version',
            component: resolve => {
                require(['@/pages/App_Version/app-version.vue'], resolve);
            }
        }]
    },
    {
        path: '/wallet',
        icon: 'social-yen',
        title: '钱包管理',
        name: 'wallet',
        component: Main,
        children: [{
            path: 'redeem-code',
            title: '兑换码',
            icon: 'pricetag',
            name: 'redeem-code',
            component: resolve => {
                require(['@/pages/Wallet_Redeem_Code/redeem-code.vue'], resolve);
            }
        }, {
            path: 'live-broadcast',
            title: '直播打赏',
            icon: 'cash',
            name: 'live-broadcast',
            component: resolve => {
                require(['@/pages/Wallet_Live_Broadcast/live-broadcast.vue'], resolve);
            }
        }, {
            path: 'user-recharge',
            title: '客户充值',
            icon: 'card',
            name: 'user-recharge',
            component: resolve => {
                require(['@/pages/Wallet_User_Recharge/user-recharge.vue'], resolve);
            }
        }, {
            path: 'user-io',
            title: '客户收支',
            icon: 'arrow-swap',
            name: 'user-io',
            component: resolve => {
                require(['@/pages/Wallet_User_Io/user-io.vue'], resolve);
            }
        }]
    },

    // {
    //     path: '/access',
    //     icon: 'key',
    //     name: 'access',
    //     title: '权限管理',
    //     access: 0,
    //     component: Main,
    //     children: [{
    //         path: 'index',
    //         title: '权限管理',
    //         access: 0,

    //         name: 'access_index',
    //         component: resolve => {
    //             require(['@/views/access/access.vue'], resolve);
    //         }
    //     }]
    // },
    // {
    //     path: '/access-test',
    //     icon: 'lock-combination',
    //     title: '权限测试页',
    //     name: 'accesstest',
    //     access: 0,
    //     component: Main,
    //     children: [{
    //         path: 'index',
    //         title: '权限测试页',
    //         name: 'accesstest_index',
    //         access: 0,
    //         component: resolve => {
    //             require(['@/views/access/access-test.vue'], resolve);
    //         }
    //     }]
    // },
    // {
    //     path: '/component',
    //     icon: 'social-buffer',
    //     name: 'component',
    //     title: '组件',
    //     component: Main,
    //     children: [{
    //             path: 'text-editor',
    //             icon: 'compose',
    //             name: 'text-editor',
    //             title: '富文本编辑器',
    //             component: resolve => {
    //                 require(['@/views/my-components/text-editor/text-editor.vue'], resolve);
    //             }
    //         },
    //         {
    //             path: 'md-editor',
    //             icon: 'pound',
    //             name: 'md-editor',
    //             title: 'Markdown编辑器',
    //             component: resolve => {
    //                 require(['@/views/my-components/markdown-editor/markdown-editor.vue'], resolve);
    //             }
    //         },
    //         {
    //             path: 'image-editor',
    //             icon: 'crop',
    //             name: 'image-editor',
    //             title: '图片预览编辑',
    //             component: resolve => {
    //                 require(['@/views/my-components/image-editor/image-editor.vue'], resolve);
    //             }
    //         },
    //         {
    //             path: 'draggable-list',
    //             icon: 'arrow-move',
    //             name: 'draggable-list',
    //             title: '可拖拽列表',
    //             component: resolve => {
    //                 require(['@/views/my-components/draggable-list/draggable-list.vue'], resolve);
    //             }
    //         },
    //         {
    //             path: 'area-linkage',
    //             icon: 'ios-more',
    //             name: 'area-linkage',
    //             title: '城市级联',
    //             component: resolve => {
    //                 require(['@/views/my-components/area-linkage/area-linkage.vue'], resolve);
    //             }
    //         },
    //         // {
    //         //     path: 'file-upload',
    //         //     icon: 'android-upload',
    //         //     name: 'file-upload',
    //         //     title: '文件上传',
    //         //     component: resolve => {
    //         //         require(['@/views/my-components/file-upload/file-upload.vue'], resolve);
    //         //     }
    //         // },
    //         {
    //             path: 'count-to',
    //             icon: 'arrow-graph-up-right',
    //             name: 'count-to',
    //             title: '数字渐变',
    //             component: resolve => {
    //                 require(['@/views/my-components/count-to/count-to.vue'], resolve);
    //             }
    //         }
    //         // {
    //         //     path: 'clipboard-page',
    //         //     icon: 'clipboard',
    //         //     name: 'clipboard-page',
    //         //     title: '一键复制',
    //         //     component: resolve => { require(['@/views/my-components/clipboard/clipboard.vue'], resolve); }
    //         // }
    //     ]
    // },
    // {
    //     path: '/form',
    //     icon: 'android-checkbox',
    //     name: 'form',
    //     title: '表单编辑',
    //     component: Main,
    //     children: [{
    //             path: 'artical-publish',
    //             title: '文章发布',
    //             name: 'artical-publish',
    //             icon: 'compose',
    //             component: resolve => {
    //                 require(['@/views/form/article-publish/article-publish.vue'], resolve);
    //             }
    //         },
    //         {
    //             path: 'workflow',
    //             title: '工作流',
    //             name: 'workflow',
    //             icon: 'arrow-swap',
    //             component: resolve => {
    //                 require(['@/views/form/work-flow/work-flow.vue'], resolve);
    //             }
    //         }
    //
    //     ]
    // },
    // // {
    // //     path: '/charts',
    // //     icon: 'ios-analytics',
    // //     name: 'charts',
    // //     title: '图表',
    // //     component: Main,
    // //     children: [
    // //         { path: 'pie', title: '饼状图', name: 'pie', icon: 'ios-pie', component: resolve => { require('@/views/access/access.vue') },
    // //         { path: 'histogram', title: '柱状图', name: 'histogram', icon: 'stats-bars', component: resolve => { require('@/views/access/access.vue') }
    //
    // //     ]
    // // },
    // {
    //     path: '/tables',
    //     icon: 'ios-grid-view',
    //     name: 'tables',
    //     title: '表格',
    //     component: Main,
    //     children: [{
    //             path: 'dragableTable',
    //             title: '可拖拽排序',
    //             name: 'dragable-table',
    //             icon: 'arrow-move',
    //             component: resolve => {
    //                 require(['@/views/tables/dragable-table.vue'], resolve);
    //             }
    //         },
    //         {
    //             path: 'editableTable',
    //             title: '可编辑表格',
    //             name: 'editable-table',
    //             icon: 'edit',
    //             component: resolve => {
    //                 require(['@/views/tables/editable-table.vue'], resolve);
    //             }
    //         },
    //         {
    //             path: 'searchableTable',
    //             title: '可搜索表格',
    //             name: 'searchable-table',
    //             icon: 'search',
    //             component: resolve => {
    //                 require(['@/views/tables/searchable-table.vue'], resolve);
    //             }
    //         },
    //         {
    //             path: 'exportableTable',
    //             title: '表格导出数据',
    //             name: 'exportable-table',
    //             icon: 'code-download',
    //             component: resolve => {
    //                 require(['@/views/tables/exportable-table.vue'], resolve);
    //             }
    //         },
    //         {
    //             path: 'table2image',
    //             title: '表格转图片',
    //             name: 'table-to-image',
    //             icon: 'images',
    //             component: resolve => {
    //                 require(['@/views/tables/table-to-image.vue'], resolve);
    //             }
    //         }
    //     ]
    // },
    // {
    //     path: '/advanced-router',
    //     icon: 'ios-infinite',
    //     name: 'advanced-router',
    //     title: '高级路由',
    //     component: Main,
    //     children: [{
    //             path: 'mutative-router',
    //             title: '动态路由',
    //             name: 'mutative-router',
    //             icon: 'link',
    //             component: resolve => {
    //                 require(['@/views/advanced-router/mutative-router.vue'], resolve);
    //             }
    //         },
    //         {
    //             path: 'argument-page',
    //             title: '带参页面',
    //             name: 'argument-page',
    //             icon: 'android-send',
    //             component: resolve => {
    //                 require(['@/views/advanced-router/argument-page.vue'], resolve);
    //             }
    //         }
    //     ]
    // },
    // {
    //     path: '/error-page',
    //     icon: 'android-sad',
    //     title: '错误页面',
    //     name: 'errorpage',
    //     component: Main,
    //     children: [{
    //         path: 'index',
    //         title: '错误页面',
    //         name: 'errorpage_index',
    //         component: resolve => {
    //             require(['@/views/error-page/error-page.vue'], resolve);
    //         }
    //     }]
    // }
];

// 所有上面定义的路由都要写在下面的routers里
export const routers = [
    loginRouter,
    otherRouter,
    preview,
    locking,
    ...appRouter,
    page500,
    page403,
    page404
];
//所有用户都能访问的写在下面的commentRouters里
export const commentRouters = [
    'login',
    'error-404',
    'error-403',
    'error-500',
    'preview',
    'locking',
    'home_index',
    'message_index',
    'personal-center'

]
